﻿using FPSO.Models.Constant;
using FPSO.Models.Domain;
using FPSO.Models.TagMapping;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace FPSO.Models.ViewModel.Controls
{
	/// <summary>
	/// NOTICE 这是一个虚拟的ViewModel，只是从数据库获取数据，不绑定到特定的控件上，涉及所有舱室配载相关的数据
	/// </summary>
	public class TankVolumeViewModel
    {
        //全船状态
        private double realMidPDraft;
		private double realMidSDraft;
		private double realAftPDraft;
        private double realAftSDraft;
        private double realFwdPDraft;
		private double realFwdSDraft;
		private double realHeel;
        private double realTrim;

        private List<double> tankvolms = new List<double>();
        private List<double> tanklevels = new List<double>();
        //货舱体积及液位高（待核对）
        private double no5COTP_Volm;
        private double no5COTS_Volm;
        private double no4COTP_Volm;
        private double no4COTS_Volm;
        private double no3COTP_Volm;
        private double no3COTS_Volm;
        private double no2COTP_Volm;
        private double no2COTS_Volm;
        private double no1COTP_Volm;
        private double no1COTS_Volm;
        private double offspec_Volm;
        private double no1SLOP_Volm;
        private double no2SLOP_Volm;

        private double no5COTP_Level;
        private double no5COTS_Level;
        private double no4COTP_Level;
        private double no4COTS_Level;
        private double no3COTP_Level;
        private double no3COTS_Level;
        private double no2COTP_Level;
        private double no2COTS_Level;
        private double no1COTP_Level;
        private double no1COTS_Level;
        private double offspec_Level;
        private double no1SLOP_Level;
        private double no2SLOP_Level;

        private double no5COTP_Temp_top;
        private double no5COTS_Temp_top;
        private double no4COTP_Temp_top;
        private double no4COTS_Temp_top;
        private double no3COTP_Temp_top;
        private double no3COTS_Temp_top;
        private double no2COTP_Temp_top;
        private double no2COTS_Temp_top;
        private double no1COTP_Temp_top;
        private double no1COTS_Temp_top;
        private double offspec_Temp_top;
        private double no1SLOP_Temp_top;
        private double no2SLOP_Temp_top;

		private double no5COTP_Temp_mid;
		private double no5COTS_Temp_mid;
		private double no4COTP_Temp_mid;
		private double no4COTS_Temp_mid;
		private double no3COTP_Temp_mid;
		private double no3COTS_Temp_mid;
		private double no2COTP_Temp_mid;
		private double no2COTS_Temp_mid;
		private double no1COTP_Temp_mid;
		private double no1COTS_Temp_mid;
		private double offspec_Temp_mid;
		private double no1SLOP_Temp_mid;
		private double no2SLOP_Temp_mid; 
		
		private double no5COTP_Temp_bottom;
		private double no5COTS_Temp_bottom;
		private double no4COTP_Temp_bottom;
		private double no4COTS_Temp_bottom;
		private double no3COTP_Temp_bottom;
		private double no3COTS_Temp_bottom;
		private double no2COTP_Temp_bottom;
		private double no2COTS_Temp_bottom;
		private double no1COTP_Temp_bottom;
		private double no1COTS_Temp_bottom;
		private double offspec_Temp_bottom;
		private double no1SLOP_Temp_bottom;
		private double no2SLOP_Temp_bottom;

		private double no5COTP_Press;
        private double no5COTS_Press;
        private double no4COTP_Press;
        private double no4COTS_Press;
        private double no3COTP_Press;
        private double no3COTS_Press;
        private double no2COTP_Press;
        private double no2COTS_Press;
        private double no1COTP_Press;
        private double no1COTS_Press;
        private double offspec_Press;
        private double no1SLOP_Press;
        private double no2SLOP_Press;
        
        //压载舱体积及液位高（待核对）
        private double no5WBTP_Volm;
        private double no5WBTS_Volm;
        private double no4WBTP_Volm;
        private double no4WBTS_Volm;
        private double no3WBTP_Volm;
        private double no3WBTS_Volm;
        private double no2WBTP_Volm;
        private double no2WBTS_Volm;
        private double no1WBTP_Volm;       
        private double no1WBTS_Volm;
        private double fpt_Volm;
        private double aptp_Volm;
        private double apts_Volm;

        private double no5WBTP_Level;
        private double no5WBTS_Level;
        private double no4WBTP_Level;
        private double no4WBTS_Level;
        private double no3WBTP_Level;
        private double no3WBTS_Level;
        private double no2WBTP_Level;
        private double no2WBTS_Level;
        private double no1WBTP_Level;
        private double no1WBTS_Level;
        private double fpt_Level;
        private double aptp_Level;
        private double apts_Level;

		//其他液舱的液位高
		private double cfueloil_Level;
		private double dot1_Level;
		private double dot2_Level;
		private double cdot_Level;
		private double pwp_Level;
		private double pws_Level;
		private double twp_Level;
		private double tws_Level;
		private double coolingp_Level;
		private double coolings_Level;
		private double todt_Level;
		private double dodt_Level;
		private double doovert_Level;
		private double bilge_Level;
		private double dhot_Level;
		private double dot_Level;
		private double sludge_Level;
		private double hydrore_Level;
		private double chydro_Level;
		private double emerfot_Level;
		private double helidt_Level;

		private double cfueloil_Volm;
		private double dot1_Volm;
		private double dot2_Volm;
		private double cdot_Volm;
		private double pwp_Volm;
		private double pws_Volm;
		private double twp_Volm;
		private double tws_Volm;
		private double coolingp_Volm;
		private double coolings_Volm;
		private double todt_Volm;
		private double dodt_Volm;
		private double doovert_Volm;
		private double bilge_Volm;
		private double dhot_Volm;
		private double dot_Volm;
		private double sludge_Volm;
		private double hydrore_Volm;
		private double chydro_Volm;
		private double emerfot_Volm;
		private double helidt_Volm;

		public TankVolumeViewModel()
        {
			realMidPDraft = 0d;
            realMidSDraft = 0d;
            realAftPDraft = 0d;
            realAftSDraft = 0d;
            realFwdPDraft = 0d;
            realFwdSDraft = 0d;
			realHeel = 0d;
            realTrim = 0d;

            int count = TankConstant.GetTanksCount();
            for (int i=0;i < count; i++)
            {
                tankvolms.Add(0d);
                tanklevels.Add(0d);
            }

            no5COTP_Volm = 0d;
            no5COTS_Volm = 0d;
            no4COTP_Volm = 0d;
            no4COTS_Volm = 0d;
            no3COTP_Volm = 0d;
            no3COTS_Volm = 0d;
            no2COTP_Volm = 0d;
            no2COTS_Volm = 0d;
            no1COTP_Volm = 0d;
            no1COTS_Volm = 0d;
            offspec_Volm = 0d;
            no1SLOP_Volm = 0d;
            no2SLOP_Volm = 0d;

            no5COTP_Level = 0d;
            no5COTS_Level = 0d;
            no4COTP_Level = 0d;
            no4COTS_Level = 0d;
            no3COTP_Level = 0d;
            no3COTS_Level = 0d;
            no2COTP_Level = 0d;
            no2COTS_Level = 0d;
            no1COTP_Level = 0d;
            no1COTS_Level = 0d;
            offspec_Level = 0d;
            no1SLOP_Level = 0d;
            no2SLOP_Level = 0d;

			no5COTP_Temp_top = 0d;
			no5COTS_Temp_top = 0d;
			no4COTP_Temp_top = 0d;
			no4COTS_Temp_top = 0d;
			no3COTP_Temp_top = 0d;
			no3COTS_Temp_top = 0d;
			no2COTP_Temp_top = 0d;
			no2COTS_Temp_top = 0d;
			no1COTP_Temp_top = 0d;
			no1COTS_Temp_top = 0d;
			offspec_Temp_top = 0d;
			no1SLOP_Temp_top = 0d;
			no2SLOP_Temp_top = 0d;

			no5COTP_Temp_mid = 0d;
			no5COTS_Temp_mid = 0d;
			no4COTP_Temp_mid = 0d;
			no4COTS_Temp_mid = 0d;
			no3COTP_Temp_mid = 0d;
			no3COTS_Temp_mid = 0d;
			no2COTP_Temp_mid = 0d;
			no2COTS_Temp_mid = 0d;
			no1COTP_Temp_mid = 0d;
			no1COTS_Temp_mid = 0d;
			offspec_Temp_mid = 0d;
			no1SLOP_Temp_mid = 0d;
			no2SLOP_Temp_mid = 0d;

			no5COTP_Temp_bottom = 0d;
			no5COTS_Temp_bottom = 0d;
			no4COTP_Temp_bottom = 0d;
			no4COTS_Temp_bottom = 0d;
			no3COTP_Temp_bottom = 0d;
			no3COTS_Temp_bottom = 0d;
			no2COTP_Temp_bottom = 0d;
			no2COTS_Temp_bottom = 0d;
			no1COTP_Temp_bottom = 0d;
			no1COTS_Temp_bottom = 0d;
			offspec_Temp_bottom = 0d;
			no1SLOP_Temp_bottom = 0d;
			no2SLOP_Temp_bottom = 0d;
			
			no5COTP_Press = 0d;
            no5COTS_Press = 0d;
            no4COTP_Press = 0d;
            no4COTS_Press = 0d;
            no3COTP_Press = 0d;
            no3COTS_Press = 0d;
            no2COTP_Press = 0d;
            no2COTS_Press = 0d;
            no1COTP_Press = 0d;
            no1COTS_Press = 0d;
            offspec_Press = 0d;
            no1SLOP_Press = 0d;
            no2SLOP_Press = 0d;
        
            no5WBTP_Volm = 0d;
            no5WBTS_Volm = 0d;
            no4WBTP_Volm = 0d;
            no4WBTS_Volm = 0d;
            no3WBTP_Volm = 0d;
            no3WBTS_Volm = 0d;
            no2WBTP_Volm = 0d;
            no2WBTS_Volm = 0d;
            no1WBTP_Volm = 0d;
            no1WBTS_Volm = 0d;
            fpt_Volm = 0d;
            aptp_Volm = 0d;
            apts_Volm = 0d;

            no5WBTP_Level = 0d;
            no5WBTS_Level = 0d;
            no4WBTP_Level = 0d;
            no4WBTS_Level = 0d;
            no3WBTP_Level = 0d;
            no3WBTS_Level = 0d;
            no2WBTP_Level = 0d;
            no2WBTS_Level = 0d;
            no1WBTP_Level = 0d;
            no1WBTS_Level = 0d;
            fpt_Level = 0d;
            aptp_Level = 0d;
            apts_Level = 0d;

			cfueloil_Level = 0d;
			dot1_Level = 0d;
			dot2_Level = 0d;
			cdot_Level = 0d;
			pwp_Level = 0d;
			pws_Level = 0d;
			twp_Level = 0d;
			tws_Level = 0d;
			coolingp_Level = 0d;
			coolings_Level = 0d;
			todt_Level = 0d;
			dodt_Level = 0d;
			doovert_Level = 0d;
			bilge_Level = 0d;
			dhot_Level = 0d;
			dot_Level = 0d;
			sludge_Level = 0d;
			hydrore_Level = 0d;
			chydro_Level = 0d;
			emerfot_Level = 0d;
			helidt_Level = 0d;

			cfueloil_Volm = 0d;
			dot1_Volm = 0d;
			dot2_Volm = 0d;
			cdot_Volm = 0d;
			pwp_Volm = 0d;
			pws_Volm = 0d;
			twp_Volm = 0d;
			tws_Volm = 0d;
			coolingp_Volm = 0d;
			coolings_Volm = 0d;
			todt_Volm = 0d;
			dodt_Volm = 0d;
			doovert_Volm = 0d;
			bilge_Volm = 0d;
			dhot_Volm = 0d;
			dot_Volm = 0d;
			sludge_Volm = 0d;
			hydrore_Volm = 0d;
			chydro_Volm = 0d;
			emerfot_Volm = 0d;
			helidt_Volm = 0d;
		}

		public Dictionary<string, double> GetTankVolumDic()
        {
            Dictionary<string, double> volmDic = new Dictionary<string, double>();
            //List<TankConstant.ConstantTankInfo> constantlist = TankConstant.ConstantList;
            //for(int i = 0;i< constantlist.Count;i++)
            //{
            //    TankConstant.ConstantTankInfo constantlisti = constantlist[i];
            //    volmDic.Add(constantlisti.TankID, tankvolms[i]);
            //}

            volmDic.Add("NO1_COT_P", no1COTP_Volm);
            volmDic.Add("NO1_COT_S", no1COTS_Volm);
            volmDic.Add("NO2_COT_P", no2COTP_Volm);
            volmDic.Add("NO2_COT_S", no2COTS_Volm);
            volmDic.Add("NO3_COT_P", no3COTP_Volm);
            volmDic.Add("NO3_COT_S", no3COTS_Volm);
            volmDic.Add("NO4_COT_P", no4COTP_Volm);
            volmDic.Add("NO4_COT_S", no4COTS_Volm);
            volmDic.Add("NO5_COT_P", no5COTP_Volm);
            volmDic.Add("NO5_COT_S", no5COTS_Volm);
            volmDic.Add("OFFSPECTANK", offspec_Volm);
            volmDic.Add("NO1_SLOP", no1SLOP_Volm);
            volmDic.Add("NO2_SLOP", no2SLOP_Volm);

            volmDic.Add("NO1_WBT_P", NO1WBTP_Volm);
            volmDic.Add("NO1_WBT_S", NO1WBTS_Volm);
            volmDic.Add("NO2_WBT_P", NO2WBTP_Volm);
            volmDic.Add("NO2_WBT_S", NO2WBTS_Volm);
            volmDic.Add("NO3_WBT_P", NO3WBTP_Volm);
            volmDic.Add("NO3_WBT_S", NO3WBTS_Volm);
            volmDic.Add("NO4_WBT_P", NO4WBTP_Volm);
            volmDic.Add("NO4_WBT_S", NO4WBTS_Volm);
            volmDic.Add("NO5_WBT_P", NO5WBTP_Volm);
            volmDic.Add("NO5_WBT_S", NO5WBTS_Volm);
            volmDic.Add("FPT", fpt_Volm);
            volmDic.Add("APTP", aptp_Volm);
            volmDic.Add("APTS", apts_Volm);

			volmDic.Add("CFUELOIL", CFUELOIL_Volm);
			volmDic.Add("DOT1", DOT1_Volm);
			volmDic.Add("DOT2", DOT2_Volm);
			volmDic.Add("CDOT", CDOT_Volm);
			volmDic.Add("PWP", PWP_Volm);
			volmDic.Add("PWS", PWS_Volm);
			volmDic.Add("TWP", TWP_Volm);
			volmDic.Add("TWS", TWS_Volm);
			volmDic.Add("COOLINGP", COOLINGP_Volm);
			volmDic.Add("COOLINGS", COOLINGS_Volm);
			volmDic.Add("TODT", TODT_Volm);
			volmDic.Add("DODT", DODT_Volm);
			volmDic.Add("DOOVERT", DOOVERT_Volm);
			volmDic.Add("BILGE", BILGE_Volm);
			volmDic.Add("DHOT", DHOT_Volm);
			volmDic.Add("DOT", DOT_Volm);
			volmDic.Add("SLUDGE", SLUDGE_Volm);
			volmDic.Add("HYDRORE", HYDRORE_Volm);
			volmDic.Add("CHYDRO", CHYDRO_Volm);
			volmDic.Add("EMERFOT", EMERFOT_Volm);
			volmDic.Add("HELIDT", HELIDT_Volm);
			return volmDic;
        }

        public Dictionary<string, double> GetTankLevelDic()
        {
            Dictionary<string, double> levelDic = new Dictionary<string, double>();
            //List<TankConstant.ConstantTankInfo> constantlist = TankConstant.ConstantList;
            //for (int i = 0; i < constantlist.Count; i++)
            //{
            //    TankConstant.ConstantTankInfo constantlisti = constantlist[i];
            //    levelDic.Add(constantlisti.TankID, tanklevels[i]);
            //}

            levelDic.Add("NO1_COT_P", no1COTP_Level);
            levelDic.Add("NO1_COT_S", no1COTS_Level);
            levelDic.Add("NO2_COT_P", no2COTP_Level);
            levelDic.Add("NO2_COT_S", no2COTS_Level);
            levelDic.Add("NO3_COT_P", no3COTP_Level);
            levelDic.Add("NO3_COT_S", no3COTS_Level);
            levelDic.Add("NO4_COT_P", no4COTP_Level);
            levelDic.Add("NO4_COT_S", no4COTS_Level);
            levelDic.Add("NO5_COT_P", no5COTP_Level);
            levelDic.Add("NO5_COT_S", no5COTS_Level);
            levelDic.Add("OFFSPECTANK", offspec_Level);
            levelDic.Add("NO1_SLOP", no1SLOP_Level);
            levelDic.Add("NO2_SLOP", no2SLOP_Level);

            levelDic.Add("NO1_WBT_P", NO1WBTP_Level);
            levelDic.Add("NO1_WBT_S", NO1WBTS_Level);
            levelDic.Add("NO2_WBT_P", NO2WBTP_Level);
            levelDic.Add("NO2_WBT_S", NO2WBTS_Level);
            levelDic.Add("NO3_WBT_P", NO3WBTP_Level);
            levelDic.Add("NO3_WBT_S", NO3WBTS_Level);
            levelDic.Add("NO4_WBT_P", NO4WBTP_Level);
            levelDic.Add("NO4_WBT_S", NO4WBTS_Level);
            levelDic.Add("NO5_WBT_P", NO5WBTP_Level);
            levelDic.Add("NO5_WBT_S", NO5WBTS_Level);
            levelDic.Add("FPT", fpt_Level);
            levelDic.Add("APTP", aptp_Level);
            levelDic.Add("APTS", apts_Level);

			levelDic.Add("CFUELOIL", CFUELOIL_Level);
			levelDic.Add("DOT1", DOT1_Level);
			levelDic.Add("DOT2", DOT2_Level);
			levelDic.Add("CDOT", CDOT_Level);
			levelDic.Add("PWP", PWP_Level);
			levelDic.Add("PWS", PWS_Level);
			levelDic.Add("TWP", TWP_Level);
			levelDic.Add("TWS", TWS_Level);
			levelDic.Add("COOLINGP", COOLINGP_Level);
			levelDic.Add("COOLINGS", COOLINGS_Level);
			levelDic.Add("TODT", TODT_Level);
			levelDic.Add("DODT", DODT_Level);
			levelDic.Add("DOOVERT", DOOVERT_Level);
			levelDic.Add("BILGE", BILGE_Level);
			levelDic.Add("DHOT", DHOT_Level);
			levelDic.Add("DOT", DOT_Level);
			levelDic.Add("SLUDGE", SLUDGE_Level);
			levelDic.Add("HYDRORE", HYDRORE_Level);
			levelDic.Add("CHYDRO", CHYDRO_Level);
			levelDic.Add("EMERFOT", EMERFOT_Level);
			levelDic.Add("HELIDT", HELIDT_Level);
			return levelDic;
        }

        public ShipDraught GetRealDraught()
        {
            ShipDraught draught = new ShipDraught();
			draught.MidPDraft = realMidPDraft;
			draught.MidSDraft = realMidSDraft;
			draught.AftPDraft = realAftPDraft;
			draught.AftSDraft = realAftSDraft;
			draught.FwdPDraft = realFwdPDraft;
			draught.FwdSDraft = realFwdSDraft;
            draught.Heel = realHeel;
            draught.Trim = realTrim;
            return draught;
        }

        [FieldMapper("NO5_COT_P.VOLM", TypeCode.Int32, TankConstant.CALC_PARAM)]
        public double NO5COTP_Volm { get { return no5COTP_Volm; } set { no5COTP_Volm = value; } }
        //[FieldMapper("NO5_COT_P.TEMP", TypeCode.Int32, TankConstant.TANKTEMP_PARAM)]
        //public double NO5COTP_Temp { get { return no5COTP_Temp; } set { no5COTP_Temp = value; } }
        //[FieldMapper("NO5_COT_P.PRESS", TypeCode.Int32, TankConstant.TANKLEVEL_PARAM)]
        //public double NO5COTP_Press { get { return no5COTP_Press; } set { no5COTP_Press = value; } }

        [FieldMapper("NO5_COT_S.VOLM", TypeCode.Int32, TankConstant.CALC_PARAM)]
        public double NO5COTS_Volm { get { return no5COTS_Volm; } set { no5COTS_Volm = value; } }
        //[FieldMapper("NO5_COT_S.TEMP", TypeCode.Int32, TankConstant.TANKTEMP_PARAM)]
        //public double NO5COTS_Temp { get { return no5COTS_Temp; } set { no5COTS_Temp = value; } }
        //[FieldMapper("NO5_COT_S.PRESS", TypeCode.Int32, TankConstant.TANKLEVEL_PARAM)]
        //public double NO5COTS_Press { get { return no5COTS_Press; } set { no5COTS_Press = value; } }

        [FieldMapper("NO4_COT_P.VOLM", TypeCode.Int32, TankConstant.CALC_PARAM)]
        public double NO4COTP_Volm { get { return no4COTP_Volm; } set { no4COTP_Volm = value; } }
		//[FieldMapper("NO4_COT_P.TEMP", TypeCode.Int32, TankConstant.TANKTEMP_PARAM)]
		//public double NO4COTP_Temp { get { return no4COTP_Temp; } set { no4COTP_Temp = value; } }
		//[FieldMapper("NO4_COT_P.PRESS", TypeCode.Int32, TankConstant.TANKLEVEL_PARAM)]
		//public double NO4COTP_Press { get { return no4COTP_Press; } set { no4COTP_Press = value; } }

		[FieldMapper("NO4_COT_S.VOLM", TypeCode.Int32, TankConstant.CALC_PARAM)]
        public double NO4COTS_Volm { get { return no4COTS_Volm; } set { no4COTS_Volm = value; } }

        [FieldMapper("NO3_COT_P.VOLM", TypeCode.Int32, TankConstant.CALC_PARAM)]
        public double NO3COTP_Volm
        {
            get { return no3COTP_Volm; }
            set
            {
                no3COTP_Volm = value;
            }
        }

        [FieldMapper("NO3_COT_S.VOLM", TypeCode.Int32, TankConstant.CALC_PARAM)]
        public double NO3COTS_Volm
        {
            get { return no3COTS_Volm; }
            set
            {
                no3COTS_Volm = value;
            }
        }

        [FieldMapper("NO2_COT_P.VOLM", TypeCode.Int32, TankConstant.CALC_PARAM)]
        public double NO2COTP_Volm
        {
            get { return no2COTP_Volm; }
            set
            {
                no2COTP_Volm = value;
            }
        }

        [FieldMapper("NO2_COT_S.VOLM", TypeCode.Int32, TankConstant.CALC_PARAM)]
        public double NO2COTS_Volm
        {
            get { return no2COTS_Volm; }
            set
            {
                no2COTS_Volm = value;
            }
        }

        [FieldMapper("NO1_COT_P.VOLM", TypeCode.Int32, TankConstant.CALC_PARAM)]
        public double NO1COTP_Volm
        {
            get { return no1COTP_Volm; }
            set
            {
                no1COTP_Volm = value;
            }
        }

        [FieldMapper("NO1_COT_S.VOLM", TypeCode.Int32, TankConstant.CALC_PARAM)]
        public double NO1COTS_Volm
        {
            get { return no1COTS_Volm; }
            set
            {
                no1COTS_Volm = value;
            }
        }

        [FieldMapper("NO5_WBT_P.VOLM", TypeCode.Int32, TankConstant.CALC_PARAM)]
        public double NO5WBTP_Volm
        {
            get { return no5WBTP_Volm; }
            set
            {
                no5WBTP_Volm = value;
            }
        }

        [FieldMapper("NO5_WBT_S.VOLM", TypeCode.Int32, TankConstant.CALC_PARAM)]
        public double NO5WBTS_Volm
        {
            get { return no5WBTS_Volm; }
            set
            {
                no5WBTS_Volm = value;
            }
        }

        [FieldMapper("NO4_WBT_P.VOLM", TypeCode.Int32, TankConstant.CALC_PARAM)]
        public double NO4WBTP_Volm
        {
            get { return no4WBTP_Volm; }
            set
            {
                no4WBTP_Volm = value;
            }
        }

        [FieldMapper("NO4_WBT_S.VOLM", TypeCode.Int32, TankConstant.CALC_PARAM)]
        public double NO4WBTS_Volm
        {
            get { return no4WBTS_Volm; }
            set
            {
                no4WBTS_Volm = value;
            }
        }

        [FieldMapper("NO3_WBT_P.VOLM", TypeCode.Int32, TankConstant.CALC_PARAM)]
        public double NO3WBTP_Volm
        {
            get { return no3WBTP_Volm; }
            set
            {
                no3WBTP_Volm = value;
            }
        }

        [FieldMapper("NO3_WBT_S.VOLM", TypeCode.Int32, TankConstant.CALC_PARAM)]
        public double NO3WBTS_Volm
        {
            get { return no3WBTS_Volm; }
            set
            {
                no3WBTS_Volm = value;
            }
        }

        [FieldMapper("NO2_WBT_P.VOLM", TypeCode.Int32, TankConstant.CALC_PARAM)]
        public double NO2WBTP_Volm
        {
            get { return no2WBTP_Volm; }
            set
            {
                no2WBTP_Volm = value;
            }
        }

        [FieldMapper("NO2_WBT_S.VOLM", TypeCode.Int32, TankConstant.CALC_PARAM)]
        public double NO2WBTS_Volm
        {
            get { return no2WBTS_Volm; }
            set
            {
                no2WBTS_Volm = value;
            }
        }

        [FieldMapper("NO1_WBT_P.VOLM", TypeCode.Int32, TankConstant.CALC_PARAM)]
        public double NO1WBTP_Volm
        {
            get { return no1WBTP_Volm; }
            set
            {
                no1WBTP_Volm = value;
            }
        }

        [FieldMapper("NO1_WBT_S.VOLM", TypeCode.Int32, TankConstant.CALC_PARAM)]
        public double NO1WBTS_Volm
        {
            get { return no1WBTS_Volm; }
            set
            {
                no1WBTS_Volm = value;
            }
        }

        [FieldMapper("FPT.VOLM", TypeCode.Int32, TankConstant.CALC_PARAM)]
        public double FPT_Volm
        {
            get { return fpt_Volm; }
            set
            {
                fpt_Volm = value;
            }
        }

		[FieldMapper("APTP.VOLM", TypeCode.Int32, TankConstant.CALC_PARAM)]
		public double APTP_Volm
		{
			get { return aptp_Volm; }
			set
			{
				aptp_Volm = value;
			}
		}

		[FieldMapper("APTS.VOLM", TypeCode.Int32, TankConstant.CALC_PARAM)]
		public double APTS_Volm
		{
			get { return apts_Volm; }
			set
			{
				apts_Volm = value;
			}
		}

        [FieldMapper("NO1_WBT_P.LEVEL", TypeCode.Int32, TankConstant.TANKLEVEL_PARAM)]
        public double NO1WBTP_Level
        {
            get { return no1WBTP_Level; }
            set
            {
                no1WBTP_Level = value;
            }
        }

        [FieldMapper("NO1_WBT_S.LEVEL", TypeCode.Int32, TankConstant.TANKLEVEL_PARAM)]
        public double NO1WBTS_Level
        {
            get { return no1WBTS_Level; }
            set
            {
                no1WBTS_Level = value;
            }
        }

        [FieldMapper("NO2_WBT_P.LEVEL", TypeCode.Int32, TankConstant.TANKLEVEL_PARAM)]
        public double NO2WBTP_Level
        {
            get { return no2WBTP_Level; }
            set
            {
                no2WBTP_Level = value;
            }
        }

        [FieldMapper("NO2_WBT_S.LEVEL", TypeCode.Int32, TankConstant.TANKLEVEL_PARAM)]
        public double NO2WBTS_Level
        {
            get { return no2WBTS_Level; }
            set
            {
                no2WBTS_Level = value;
            }
        }

        [FieldMapper("NO3_WBT_P.LEVEL", TypeCode.Int32, TankConstant.TANKLEVEL_PARAM)]
        public double NO3WBTP_Level
        {
            get { return no3WBTP_Level; }
            set
            {
                no3WBTP_Level = value;
            }
        }

        [FieldMapper("NO3_WBT_S.LEVEL", TypeCode.Int32, TankConstant.TANKLEVEL_PARAM)]
        public double NO3WBTS_Level
        {
            get { return no3WBTS_Level; }
            set
            {
                no3WBTS_Level = value;
            }
        }

        [FieldMapper("NO4_WBT_P.LEVEL", TypeCode.Int32, TankConstant.TANKLEVEL_PARAM)]
        public double NO4WBTP_Level
        {
            get { return no4WBTP_Level; }
            set
            {
                no4WBTP_Level = value;
            }
        }

        [FieldMapper("NO4_WBT_S.LEVEL", TypeCode.Int32, TankConstant.TANKLEVEL_PARAM)]
        public double NO4WBTS_Level
        {
            get { return no4WBTS_Level; }
            set
            {
                no4WBTS_Level = value;
            }
        }

        [FieldMapper("NO5_WBT_P.LEVEL", TypeCode.Int32, TankConstant.TANKLEVEL_PARAM)]
        public double NO5WBTP_Level
        {
            get { return no5WBTP_Level; }
            set
            {
                no5WBTP_Level = value;
            }
        }

        [FieldMapper("NO5_WBT_S.LEVEL", TypeCode.Int32, TankConstant.TANKLEVEL_PARAM)]
        public double NO5WBTS_Level
        {
            get { return no5WBTS_Level; }
            set
            {
                no5WBTS_Level = value;
            }
        }

        [FieldMapper("FPT.LEVEL", TypeCode.Int32, TankConstant.TANKLEVEL_PARAM)]
        public double FPT_Level
        {
            get { return fpt_Level; }
            set
            {
                fpt_Level = value;
            }
        }

		[FieldMapper("APTP.LEVEL", TypeCode.Int32, TankConstant.TANKLEVEL_PARAM)]
		public double APTP_Level
		{
			get { return aptp_Level; }
			set
			{
				aptp_Level = value;
			}
		}

		[FieldMapper("APTS.LEVEL", TypeCode.Int32, TankConstant.TANKLEVEL_PARAM)]
		public double APTS_Level
		{
			get { return apts_Level; }
			set
			{
				apts_Level = value;
			}
		}

		//DEBUG
		[FieldMapper("NO1_COT_P.LEVEL", TypeCode.Int32, TankConstant.TANKLEVEL_PARAM)]
		public double NO1COTP_Level
        {
            get 
			{
				return no1COTP_Level;
			}
            set
            {
                no1COTP_Level = value;
            }
        }

        [FieldMapper("NO1_COT_S.LEVEL", TypeCode.Int32, TankConstant.TANKLEVEL_PARAM)]
        public double NO1COTS_Level
        {
            get { return no1COTS_Level; }
            set
            {
                no1COTS_Level = value;
            }
        }

        [FieldMapper("NO2_COT_P.LEVEL", TypeCode.Int32, TankConstant.TANKLEVEL_PARAM)]
        public double NO2COTP_Level
        {
            get { return no2COTP_Level; }
            set
            {
                no2COTP_Level = value;
            }
        }

        [FieldMapper("NO2_COT_S.LEVEL", TypeCode.Int32, TankConstant.TANKLEVEL_PARAM)]
        public double NO2COTS_Level
        {
            get { return no2COTS_Level; }
            set
            {
                no2COTS_Level = value;
            }
        }

        [FieldMapper("NO3_COT_P.LEVEL", TypeCode.Int32, TankConstant.TANKLEVEL_PARAM)]
        public double NO3COTP_Level
        {
            get { return no3COTP_Level; }
            set
            {
                no3COTP_Level = value;
            }
        }

        [FieldMapper("NO3_COT_S.LEVEL", TypeCode.Int32, TankConstant.TANKLEVEL_PARAM)]
        public double NO3COTS_Level
        {
            get { return no3COTS_Level; }
            set
            {
                no3COTS_Level = value;
            }
        }

        [FieldMapper("NO4_COT_P.LEVEL", TypeCode.Int32, TankConstant.TANKLEVEL_PARAM)]
        public double NO4COTP_Level
        {
            get { return no4COTP_Level; }
            set
            {
                no4COTP_Level = value;
            }
        }

        [FieldMapper("NO4_COT_S.LEVEL", TypeCode.Int32, TankConstant.TANKLEVEL_PARAM)]
        public double NO4COTS_Level
        {
            get { return no4COTS_Level; }
            set
            {
                no4COTS_Level = value;
            }
        }

        [FieldMapper("NO5_COT_P.LEVEL", TypeCode.Int32, TankConstant.TANKLEVEL_PARAM)]
        public double NO5COTP_Level
        {
            get { return no5COTP_Level; }
            set
            {
                no5COTP_Level = value;
            }
        }

        [FieldMapper("NO5_COT_S.LEVEL", TypeCode.Int32, TankConstant.TANKLEVEL_PARAM)]
        public double NO5COTS_Level
        {
            get { return no5COTS_Level; }
            set
            {
                no5COTS_Level = value;
            }
        }

		[FieldMapper("OFFSPECTANK.LEVEL", TypeCode.Int32, TankConstant.TANKLEVEL_PARAM)]
		public double OFFSPECTANK_Level
		{
			get { return offspec_Level; }
			set
			{
				offspec_Level = value;
			}
		}

		[FieldMapper("NO1_SLOP.LEVEL", TypeCode.Int32, TankConstant.TANKLEVEL_PARAM)]
		public double NO1_SLOP_Level
		{
			get { return no1SLOP_Level; }
			set
			{
				no1SLOP_Level = value;
			}
		}

		[FieldMapper("NO2_SLOP.LEVEL", TypeCode.Int32, TankConstant.TANKLEVEL_PARAM)]
		public double NO2_SLOP_Level
		{
			get { return no2SLOP_Level; }
			set
			{
				no2SLOP_Level = value;
			}
		}

		//其他液舱
		[FieldMapper("CFUELOIL.LEVEL", TypeCode.Int32, TankConstant.TANKLEVEL_PARAM)]
		public double CFUELOIL_Level
		{
			get { return cfueloil_Level; }
			set
			{
				cfueloil_Level = value;
			}
		}

		[FieldMapper("DOT1.LEVEL", TypeCode.Int32, TankConstant.TANKLEVEL_PARAM)]
		public double DOT1_Level
		{
			get { return dot1_Level; }
			set
			{
				dot1_Level = value;
			}
		}

		[FieldMapper("DOT2.LEVEL", TypeCode.Int32, TankConstant.TANKLEVEL_PARAM)]
		public double DOT2_Level
		{
			get { return dot2_Level; }
			set
			{
				dot2_Level = value;
			}
		}

		[FieldMapper("CDOT.LEVEL", TypeCode.Int32, TankConstant.TANKLEVEL_PARAM)]
		public double CDOT_Level
		{
			get { return cdot_Level; }
			set
			{
				cdot_Level = value;
			}
		}

		[FieldMapper("PWP.LEVEL", TypeCode.Int32, TankConstant.TANKLEVEL_PARAM)]
		public double PWP_Level
		{
			get { return pwp_Level; }
			set
			{
				pwp_Level = value;
			}
		}

		[FieldMapper("PWS.LEVEL", TypeCode.Int32, TankConstant.TANKLEVEL_PARAM)]
		public double PWS_Level
		{
			get { return pws_Level; }
			set
			{
				pws_Level = value;
			}
		}

		[FieldMapper("TWP.LEVEL", TypeCode.Int32, TankConstant.TANKLEVEL_PARAM)]
		public double TWP_Level
		{
			get { return twp_Level; }
			set
			{
				twp_Level = value;
			}
		}

		[FieldMapper("TWS.LEVEL", TypeCode.Int32, TankConstant.TANKLEVEL_PARAM)]
		public double TWS_Level
		{
			get { return tws_Level; }
			set
			{
				tws_Level = value;
			}
		}

		[FieldMapper("COOLINGP.LEVEL", TypeCode.Int32, TankConstant.TANKLEVEL_PARAM)]
		public double COOLINGP_Level
		{
			get { return coolingp_Level; }
			set
			{
				coolingp_Level = value;
			}
		}

		[FieldMapper("COOLINGS.LEVEL", TypeCode.Int32, TankConstant.TANKLEVEL_PARAM)]
		public double COOLINGS_Level
		{
			get { return coolings_Level; }
			set
			{
				coolings_Level = value;
			}
		}

		[FieldMapper("TODT.LEVEL", TypeCode.Int32, TankConstant.TANKLEVEL_PARAM)]
		public double TODT_Level
		{
			get { return todt_Level; }
			set
			{
				todt_Level = value;
			}
		}

		[FieldMapper("DODT.LEVEL", TypeCode.Int32, TankConstant.TANKLEVEL_PARAM)]
		public double DODT_Level
		{
			get { return dodt_Level; }
			set
			{
				dodt_Level = value;
			}
		}
		[FieldMapper("DOOVERT.LEVEL", TypeCode.Int32, TankConstant.TANKLEVEL_PARAM)]
		public double DOOVERT_Level
		{
			get { return doovert_Level; }
			set
			{
				doovert_Level = value;
			}
		}

		[FieldMapper("BILGE.LEVEL", TypeCode.Int32, TankConstant.TANKLEVEL_PARAM)]
		public double BILGE_Level
		{
			get { return bilge_Level; }
			set
			{
				bilge_Level = value;
			}
		}

		[FieldMapper("DHOT.LEVEL", TypeCode.Int32, TankConstant.TANKLEVEL_PARAM)]
		public double DHOT_Level
		{
			get { return dhot_Level; }
			set
			{
				dhot_Level = value;
			}
		}

		[FieldMapper("DOT.LEVEL", TypeCode.Int32, TankConstant.TANKLEVEL_PARAM)]
		public double DOT_Level
		{
			get { return dot_Level; }
			set
			{
				dot_Level = value;
			}
		}

		[FieldMapper("SLUDGE.LEVEL", TypeCode.Int32, TankConstant.TANKLEVEL_PARAM)]
		public double SLUDGE_Level
		{
			get { return sludge_Level; }
			set
			{
				sludge_Level = value;
			}
		}

		[FieldMapper("HYDRORE.LEVEL", TypeCode.Int32, TankConstant.TANKLEVEL_PARAM)]
		public double HYDRORE_Level
		{
			get { return hydrore_Level; }
			set
			{
				hydrore_Level = value;
			}
		}

		[FieldMapper("CHYDRO.LEVEL", TypeCode.Int32, TankConstant.TANKLEVEL_PARAM)]
		public double CHYDRO_Level
		{
			get { return chydro_Level; }
			set
			{
				chydro_Level = value;
			}
		}

		[FieldMapper("EMERFOT.LEVEL", TypeCode.Int32, TankConstant.TANKLEVEL_PARAM)]
		public double EMERFOT_Level
		{
			get { return emerfot_Level; }
			set
			{
				emerfot_Level = value;
			}
		}

		[FieldMapper("HELIDT.LEVEL", TypeCode.Int32, TankConstant.TANKLEVEL_PARAM)]
		public double HELIDT_Level
		{
			get { return helidt_Level; }
			set
			{
				helidt_Level = value;
			}
		}

		[FieldMapper("CFUELOIL.VOLM", TypeCode.Int32, TankConstant.CALC_PARAM)]
		public double CFUELOIL_Volm
		{
			get { return cfueloil_Volm; }
			set
			{
				cfueloil_Volm = value;
			}
		}

		[FieldMapper("DOT1.VOLM", TypeCode.Int32, TankConstant.CALC_PARAM)]
		public double DOT1_Volm
		{
			get { return dot1_Volm; }
			set
			{
				dot1_Volm = value;
			}
		}

		[FieldMapper("DOT2.VOLM", TypeCode.Int32, TankConstant.CALC_PARAM)]
		public double DOT2_Volm
		{
			get { return dot2_Volm; }
			set
			{
				dot2_Volm = value;
			}
		}

		[FieldMapper("CDOT.VOLM", TypeCode.Int32, TankConstant.CALC_PARAM)]
		public double CDOT_Volm
		{
			get { return cdot_Volm; }
			set
			{
				cdot_Volm = value;
			}
		}

		[FieldMapper("PWP.VOLM", TypeCode.Int32, TankConstant.CALC_PARAM)]
		public double PWP_Volm
		{
			get { return pwp_Volm; }
			set
			{
				pwp_Volm = value;
			}
		}

		[FieldMapper("PWS.VOLM", TypeCode.Int32, TankConstant.CALC_PARAM)]
		public double PWS_Volm
		{
			get { return pws_Volm; }
			set
			{
				pws_Volm = value;
			}
		}

		[FieldMapper("TWP.VOLM", TypeCode.Int32, TankConstant.CALC_PARAM)]
		public double TWP_Volm
		{
			get { return twp_Volm; }
			set
			{
				twp_Volm = value;
			}
		}

		[FieldMapper("TWS.VOLM", TypeCode.Int32, TankConstant.CALC_PARAM)]
		public double TWS_Volm
		{
			get { return tws_Volm; }
			set
			{
				tws_Volm = value;
			}
		}

		[FieldMapper("COOLINGP.VOLM", TypeCode.Int32, TankConstant.CALC_PARAM)]
		public double COOLINGP_Volm
		{
			get { return coolingp_Volm; }
			set
			{
				coolingp_Volm = value;
			}
		}

		[FieldMapper("COOLINGS.VOLM", TypeCode.Int32, TankConstant.CALC_PARAM)]
		public double COOLINGS_Volm
		{
			get { return coolings_Volm; }
			set
			{
				coolings_Volm = value;
			}
		}

		[FieldMapper("TODT.VOLM", TypeCode.Int32, TankConstant.CALC_PARAM)]
		public double TODT_Volm
		{
			get { return todt_Volm; }
			set
			{
				todt_Volm = value;
			}
		}

		[FieldMapper("DODT.VOLM", TypeCode.Int32, TankConstant.CALC_PARAM)]
		public double DODT_Volm
		{
			get { return dodt_Volm; }
			set
			{
				dodt_Volm = value;
			}
		}
		[FieldMapper("DOOVERT.VOLM", TypeCode.Int32, TankConstant.CALC_PARAM)]
		public double DOOVERT_Volm
		{
			get { return doovert_Volm; }
			set
			{
				doovert_Volm = value;
			}
		}

		[FieldMapper("BILGE.VOLM", TypeCode.Int32, TankConstant.CALC_PARAM)]
		public double BILGE_Volm
		{
			get { return bilge_Volm; }
			set
			{
				bilge_Volm = value;
			}
		}

		[FieldMapper("DHOT.VOLM", TypeCode.Int32, TankConstant.CALC_PARAM)]
		public double DHOT_Volm
		{
			get { return dhot_Volm; }
			set
			{
				dhot_Volm = value;
			}
		}

		[FieldMapper("DOT.VOLM", TypeCode.Int32, TankConstant.CALC_PARAM)]
		public double DOT_Volm
		{
			get { return dot_Volm; }
			set
			{
				dot_Volm = value;
			}
		}

		[FieldMapper("SLUDGE.VOLM", TypeCode.Int32, TankConstant.CALC_PARAM)]
		public double SLUDGE_Volm
		{
			get { return sludge_Volm; }
			set
			{
				sludge_Volm = value;
			}
		}

		[FieldMapper("HYDRORE.VOLM", TypeCode.Int32, TankConstant.CALC_PARAM)]
		public double HYDRORE_Volm
		{
			get { return hydrore_Volm; }
			set
			{
				hydrore_Volm = value;
			}
		}

		[FieldMapper("CHYDRO.VOLM", TypeCode.Int32, TankConstant.CALC_PARAM)]
		public double CHYDRO_Volm
		{
			get { return chydro_Volm; }
			set
			{
				chydro_Volm = value;
			}
		}

		[FieldMapper("EMERFOT.VOLM", TypeCode.Int32, TankConstant.CALC_PARAM)]
		public double EMERFOT_Volm
		{
			get { return emerfot_Volm; }
			set
			{
				emerfot_Volm = value;
			}
		}

		[FieldMapper("HELIDT.VOLM", TypeCode.Int32, TankConstant.CALC_PARAM)]
		public double HELIDT_Volm
		{
			get { return helidt_Volm; }
			set
			{
				helidt_Volm = value;
			}
		}       
		
		/// <summary>
		/// 监测舯吃水(左舷)
		/// </summary>
		[FieldMapper("SHIP.REAL_MIDP_DRAFT", TypeCode.Int32, TankConstant.DRAFTSTATUS_PARAM)]
        public double RealMidPDraft
        { 
            get
            { 
                return realMidPDraft;
            } 
            set
            {
				realMidPDraft = value;
				realHeel = realMidPDraft - realMidSDraft;
			}
		}

		/// <summary>
		/// 监测舯吃水(右舷)
		/// </summary>
		[FieldMapper("SHIP.REAL_MIDS_DRAFT", TypeCode.Int32, TankConstant.DRAFTSTATUS_PARAM)]
		public double RealMidSDraft
		{
			get
			{
				return realMidSDraft;
			}
			set
			{
				realMidSDraft = value;
				realHeel = Math.Atan((realMidPDraft - realMidSDraft) / 45.2) * 57.3;
			}
		}
		/// <summary>
		/// 监测艉吃水(左舷)
		/// </summary>
		[FieldMapper("SHIP.REAL_AFTP_DRAFT", TypeCode.Int32, TankConstant.DRAFTSTATUS_PARAM)]
        public double RealAftPDraft
        {
            get
            { 
                return realAftPDraft; 
            } 
            set
            {
				realAftPDraft = value;
				realTrim = ((realAftPDraft + realAftSDraft) - (realFwdPDraft + realFwdSDraft)) / 2;
			}
        }
		/// <summary>
		/// 监测艉吃水(右舷)
		/// </summary>
		[FieldMapper("SHIP.REAL_AFTS_DRAFT", TypeCode.Int32, TankConstant.DRAFTSTATUS_PARAM)]
        public double RealAftSDraft
		{
            get { return realAftSDraft; }
            set
            {
				realAftSDraft = value;
				realTrim = ((realAftPDraft + realAftSDraft) - (realFwdPDraft + realFwdSDraft)) / 2;
			}
		}

        /// <summary>
        /// 监测艏吃水(左舷)
        /// </summary>
        [FieldMapper("SHIP.REAL_FWDP_DRAFT", TypeCode.Int32, TankConstant.DRAFTSTATUS_PARAM)]
        public double RealFwdPDraft
        {
            get { return realFwdPDraft; }
            set
            {
				realFwdPDraft = value;
				realTrim = ((realAftPDraft + realAftSDraft) - (realFwdPDraft + realFwdSDraft)) / 2;
			}
		}

		/// <summary>
		/// 监测艏吃水(右舷)
		/// </summary>
		[FieldMapper("SHIP.REAL_FWDS_DRAFT", TypeCode.Int32, TankConstant.DRAFTSTATUS_PARAM)]
		public double RealFwdSDraft
		{
			get { return realFwdSDraft; }
			set
			{
				realFwdSDraft = value;
				realTrim = ((realAftPDraft + realAftSDraft) - (realFwdPDraft + realFwdSDraft)) / 2;
			}
		}

		/// <summary>
		/// 监测横倾
		/// </summary>
		[FieldMapper("SHIP.REAL_HEEL", TypeCode.Int32, TankConstant.DRAFTSTATUS_PARAM)]
		public double RealHeel
        {
            get { return realHeel; }
            set
            {
                realHeel = value;
            }
        }

		/// <summary>
		/// 监测纵倾
		/// </summary>
		[FieldMapper("SHIP.REAL_TRIM", TypeCode.Int32, TankConstant.DRAFTSTATUS_PARAM)]
		public double RealTrim
        {
            get { return realTrim; }
            set
            {
                realTrim = value;
            }
        }

    }
}
